# -*- coding: utf-8 -*-
# @Time    : 2022/8/6 17:34
# @Author  : Weijian Yi
# @File    : response.py
# @Software: PyCharm
from rest_framework.response import Response

import rest_framework.response


class R:
    @classmethod
    def ok(cls, data=None, msg=""):
        if data is None:
            data = {}
        res = {
            'data': data,
            'msg': msg,
            'ok': True
        }
        return Response(res)

    @classmethod
    def failed(cls, data=None, msg=""):
        if data is None:
            data = {}
        res = {
            'data': data,
            'msg': msg,
            'ok': False
        }
        return Response(res)